package com.oig.sys.auth.entity;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
import java.io.Serializable;


/**
 * @author wuxl
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = "tb_resource_data_cfg")
public class TbResourceDataCfg implements Serializable {

	/**
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	private Integer id;

	/**
	 */
	@Column(name = "resource_id")
	private Integer resourceId;

	/**
	 * 0-按角色限定 1-按岗位限定 2-按部门限定
	 */
	@Column(name = "user_relation_type")
	private String userRelationType;

	/**
	 */
	@Column(name = "user_relation_id")
	private Integer userRelationId;

	/**
	 * 0-按用户id匹配 9-自定义sql
	 */
	@Column(name = "data_eq_type")
	private String dataEqType;

	/**
	 * 从资源数据列表里选择column_field
	 */
	@Column(name = "data_eq_filed", length = 128)
	private String dataEqFiled;

	/**
	 * 限定值或sql模板 type=1时填值，type=9时填条件sql
	 */
	@Column(name = "data_eq_sql", length = 512)
	private String dataEqSql;

	/**
	 */
	@Column(name = "status")
	private String status;

	/**
	 * 格式：[{"id":"1","name":"admin"}]
	 */
	@Column(name = "whitelist", length = 1024)
	private String whitelist;


	/**
	 * 没有权限的数据列
	 */
	@Column(name = "exclude_filed", length = 256)
	private String excludeFiled;

	/**
	 */
	@Column(name = "create_user_id")
	private Integer createUserId;

	/**
	 */
	@Column(name = "create_user_name", length = 32)
	private String createUserName;

	@CreatedDate
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time")
	private java.util.Date createTime;

	/**
	 */
	@Column(name = "last_update_id")
	private Integer lastUpdateId;

	/**
	 */
	@Column(name = "last_update_name", length = 32)
	private String lastUpdateName;

	/**
	 */
	@LastModifiedDate
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_update_time")
	private java.util.Date lastUpdateTime;

	/**
	 */
	@Version
	@Column(name = "version")
	private Integer version;

	/**
	 * 租户id
	 */
	@Column(name = "tenant_id")
	private Integer tenantId;
	@Column(name = "tenant_code")
	private String tenantCode;
	/**
	 */
	@Column(name = "tenant_name", length = 128)
	private String tenantName;
}
